package gps;

import java.util.List;

import gps_api.Rule;
import gps_api.State;

/**
 * Represent an inform or blind method
 * @author Pablo
 *
 */
public interface SolverMethod {
	
	/**
	 * Initialize the method, creating the
	 * opened nodes and closed nodes list.
	 * @param state
	 */
	public void initMethod(State state);
	
	
	/**
	 * Add a child node to open node list.
	 * It's responsible of sort the list if its
	 * necessary.
	 * @param node
	 * 
	 */
	public void addChild(State state, Rule rule);
	
	
	/**
	 * Filter the repeats nodes in the 
	 * open and close list.
	 * @param nodes
	 */
	public void filterRepeatNodes(List<Node> nodes);
	
	/**
	 * Return the next node in the opened node list.
	 * It's responsible for remove the node from
	 * the opened list and push it in the closed list.
	 * @return
	 */
	public Node getNextNode();
	
	/**
	 * Return True if the opened node list
	 * is empty.
	 * @return
	 */
	public boolean isEmptyOpenNodes();
	
	/**
	 * Return true if has and equal ancestor
	 * @param node
	 * @param rule
	 * @param state
	 * @return
	 */
	public boolean hasEqualAncestor(State state);
	
	/**
	 * Return true if the state have already opened.
	 * @param state
	 * @return
	 */
	public boolean isInClosedList(State state);
	
	/**
	 * Return True if in the open list are an
	 * equal node with less or equal cost. 
	 * Otherwise delete the node in the list and
	 * return False.
	 * @param newNode
	 * @return
	 */
	public boolean isInOpenedList(Node newNode);
	
	/**
	 * Print all the rules to arrives from the
	 * root to the goal node. 
	 * @param
	 */
	public void printSolution();
	
	/**
	 * Return the max level the method reach
	 * @return
	 */
	public Integer getMaxLevel();
	
	/**
	 * Return the size of the open node
	 * list.
	 * @return
	 */
	public Integer getOpenListSize();
	
	/**
	 * Return the size of the closed node
	 * list.
	 * @return
	 */
	public Integer getCloseListSize();
	
	public void setLookCloseList(boolean lookCloseList);

	public void setLookOpenList(boolean lookOpenList);
	
	
}
